const app = getApp();
Page({
  data: {
    year:'',
    month:'',
    card_list:[],
    rece_sum:0.00,
    pay_sum:0.00,
  },

  onShow:function(){
    this.getUserInfo(); //获取用户信息
  },

  onLoad:function(options){
    console.log(options);
  },

  
  //获取个人信息
  getUserInfo:function(){
    let _this = this;
    app._post('api/member/getUserInfo', {}, function(result) {
      if(result.code == 200){
        _this.get_card_list();
      }else{
        wx.navigateTo({
          url: '/pages/auth/auth'
        })
      }
    });
  },

  //获取银行卡列表
  get_card_list:function(){
    let _this = this;
    app._post('api/member/get_card_list', {}, function(result) {
      if(result.code == 200){
        _this.setData({
          card_list:result.data,
        })
      }else{
        _this.setData({
          is_login:false,
        })
      }
    });
  },


  //前往详情
  to_card_detail:function(e){
    let _this = this,
      card_id = e.currentTarget.dataset.cardid;;
    wx.navigateTo({
      url: './card_detail?card_id='+card_id
    })
  },
})